layui.use(['element', 'layer', 'form', 'table','laydate'], function () {
    var element = layui.element;
    var table = layui.table;
    var layer = layui.layer;
    var form = layui.form;
    var active={
        addRepairInfo:function () {
            var phone =  $('#myphone').val();
            var address =  $('#myaddress').val();
            var title =  $('#mytitle').val();
            var reason =  $('#myreason').val();
            if (phone == '' || address =='' || title== '' || reason =='') {
                layer.msg('数据不可为空');
                return false;
            }
            var params = $.param({
                phone: phone,
                address: address,
                title: title,
                reason: reason
            }, true);
            $.ajax({
                url: '/front/myCenter/repair/addOneRepair',
                type: 'post',
                data: params,
                dataType: 'json',
                success: function (e) {
                    layer.msg(e.msg);
                    if (e.msg == "添加成功") {
                        $('#myphone').val('');
                        $('#myaddress').val('');
                        $('#mytitle').val('');
                        $('#myreason').val('');
                    }
                }
            })
        }
    };

    $('.addRepairInfo .layui-btn').on('click', function () {
        var type = $(this).data('type');
        active[type] ? active[type].call(this) : '';
    });



});